{% extends "base.html" %}


{% block title %}
新闻管理
{% endblock %}

{% block label %}
新闻管理<a class="btn btn-default pull-right" href="/OA/add_news/">添加</a>
{% endblock %}


{% block contenter %}
        <div class="row">
            <table class="table">
                <thead>
                <tr>
                    <th>标题</th>
                    <th>作者</th>
                    <th>时间</th>
                    <th>操作</th>
                </tr>
                </thead>
                <tbody>
                {{ news }}
                {% for new in news_list.items %}
                <tr>
                    <td class="col-lg-3">{{ new.title }}</td>
                    <td class="col-lg-3">{{ new.author }}</td>
                    <td class="col-lg-3">{{ new.public_time }}</td>
                    <td class="col-lg-3">
                        <a class="btn btn-default" href="/OA/detail_news/{{ new.id }}/">详情</a>
                        <a class="btn btn-default" href="/OA/edit_news/{{ new.id }}/">编辑</a>
                        <a class="btn btn-default" href="/OA/delete_news/{{ new.id }}/">删除</a>
                    </td>
                </tr>
                {% endfor %}
                </tbody>
            </table>
        </div>
        <ul class="pagination pull-left">
            <li><a href="/OA/news/?news_id=1">首页</a></li>
            {% if news_list.has_prev %}
            <li><a href="/oa/news/?news_id={{ news_list.prev_num }}">上一页</a></li>
            {% endif %}
            {% for news in news_list.iter_pages() %}
                {% if news %}
                        {% if news == news_id %}
                            <li class="active"><a href="#">{{ news }}</a></li>
                        {% else %}
                            <li><a href="/OA/news/?news_id={{ news }}">{{ news }}</a></li>
                        {% endif %}
                {% else %}
                    <li><a href="#">....</a></li>
                {% endif %}
            {% endfor %}
            {% if news_list.has_next %}
            <li><a href="/OA/news/?news_id={{ news_list.next_num }}">下一页</a></li>
            {% endif %}
            {% if news_list.news_id != news_list.pages %}
            <li><a href="/OA/news/?news_id={{ news_list.pages }}">尾页</a></li>
            {% endif %}
        </ul>
{% endblock %}